home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import com.plus9.mockups.dialogs.IImportImageDialog;
- import com.plus9.mockups.dialogs.ImportImagePanels.IImportImagePanel;
- import com.plus9.mockups.ui.SketchableLoadingProgressImage;
- import flash.accessibility.*;
- import flash.data.*;
- import flash.debugger.*;
- import flash.desktop.*;
- import flash.display.*;
- import flash.errors.*;
- import flash.events.*;
- import flash.external.*;
- import flash.filesystem.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.html.*;
- import flash.html.script.*;
- import flash.media.*;
- import flash.net.*;
- import flash.printing.*;
- import flash.profiler.*;
- import flash.system.*;
- import flash.text.*;
- import flash.ui.*;
- import flash.utils.*;
- import flash.xml.*;
- import mx.binding.*;
- import mx.containers.Canvas;
- import mx.controls.Button;
- import mx.controls.Label;
- import mx.core.UIComponentDescriptor;
- import mx.core.mx_internal;
- import mx.events.FlexEvent;
- import mx.events.PropertyChangeEvent;
- import mx.styles.*;
-
- public class ImportImageFilePanel extends Canvas implements IImportImagePanel
- {
- protected var _mainDialog:IImportImageDialog;
-
- private var _2040040073_preview:SketchableLoadingProgressImage;
-
- protected var _file:File;
-
- private var _94482_cv:Canvas;
-
- private var _645204090_fileName:Label;
-
- private var _1327866793_browse:Button;
-
- private var _documentDescriptor_:UIComponentDescriptor;
-
- public function ImportImageFilePanel()
- {
- _documentDescriptor_ = new UIComponentDescriptor({
- "type":Canvas,
- "propertiesFactory":function():Object
- {
- return {
- "height":384,
- "width":588,
- "childDescriptors":[new UIComponentDescriptor({
- "type":Label,
- "stylesFactory":function():void
- {
- this.textAlign = "right";
- },
- "propertiesFactory":function():Object
- {
- return {
- "x":10,
- "y":7,
- "text":"Image File:",
- "width":61
- };
- }
- }),new UIComponentDescriptor({
- "type":Label,
- "id":"_fileName",
- "stylesFactory":function():void
- {
- this.left = "82";
- },
- "propertiesFactory":function():Object
- {
- return {
- "y":7,
- "width":421
- };
- }
- }),new UIComponentDescriptor({
- "type":Canvas,
- "id":"_cv",
- "events":{"click":"___cv_click"},
- "stylesFactory":function():void
- {
- this.borderColor = 0;
- this.left = "80";
- this.borderStyle = "solid";
- },
- "propertiesFactory":function():Object
- {
- return {
- "y":5,
- "toolTip":"Click to browse",
- "height":24,
- "width":425
- };
- }
- }),new UIComponentDescriptor({
- "type":Button,
- "id":"_browse",
- "events":{"click":"___browse_click"},
- "stylesFactory":function():void
- {
- this.right = "10";
- },
- "propertiesFactory":function():Object
- {
- return {
- "y":5,
- "label":"Browse...",
- "width":70
- };
- }
- }),new UIComponentDescriptor({
- "type":Label,
- "propertiesFactory":function():Object
- {
- return {
- "x":28,
- "y":33,
- "text":"Preview"
- };
- }
- }),new UIComponentDescriptor({
- "type":Canvas,
- "stylesFactory":function():void
- {
- this.borderColor = 0;
- this.backgroundColor = 16315883;
- this.borderStyle = "solid";
- },
- "propertiesFactory":function():Object
- {
- return {
- "x":80,
- "y":34,
- "width":498,
- "height":344
- };
- }
- }),new UIComponentDescriptor({
- "type":SketchableLoadingProgressImage,
- "id":"_preview",
- "propertiesFactory":function():Object
- {
- return {
- "x":82,
- "y":36,
- "width":494,
- "height":340
- };
- }
- })]
- };
- }
- });
- super();
- mx_internal::_document = this;
- this.label = "File";
- this.height = 384;
- this.width = 588;
- this.addEventListener("creationComplete",___ImportImageFilePanel_Canvas1_creationComplete);
- }
-
- [Bindable(event="propertyChange")]
- public function get _fileName() : Label
- {
- return this._645204090_fileName;
- }
-
- public function set mainDialog(param1:IImportImageDialog) : void
- {
- _mainDialog = param1;
- _mainDialog.enableLoad(false);
- if(_browse)
- {
- _browse.setFocus();
- }
- }
-
- public function ___cv_click(param1:MouseEvent) : void
- {
- onClick(param1);
- }
-
- public function ___ImportImageFilePanel_Canvas1_creationComplete(param1:FlexEvent) : void
- {
- onCreationComplete();
- }
-
- override public function initialize() : void
- {
- mx_internal::setDocumentDescriptor(_documentDescriptor_);
- super.initialize();
- }
-
- public function ___browse_click(param1:MouseEvent) : void
- {
- onClick(param1);
- }
-
- public function set _fileName(param1:Label) : void
- {
- var _loc2_:Object = this._645204090_fileName;
- if(_loc2_ !== param1)
- {
- this._645204090_fileName = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_fileName",_loc2_,param1));
- }
- }
-
- public function set sketched(param1:Boolean) : void
- {
- _preview.sketched = param1;
- }
-
- [Bindable(event="propertyChange")]
- public function get _preview() : SketchableLoadingProgressImage
- {
- return this._2040040073_preview;
- }
-
- public function set _browse(param1:Button) : void
- {
- var _loc2_:Object = this._1327866793_browse;
- if(_loc2_ !== param1)
- {
- this._1327866793_browse = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_browse",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get _cv() : Canvas
- {
- return this._94482_cv;
- }
-
- protected function onClick(param1:Event) : void
- {
- switch(param1.target)
- {
- case _browse:
- case _cv:
- _file = new File();
- _file.browseForOpen("Please select the image to embed",[new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)","*.jpg;*.jpeg;*.gif;*.png")]);
- _file.addEventListener(Event.SELECT,onSelect);
- }
- }
-
- public function set _cv(param1:Canvas) : void
- {
- var _loc2_:Object = this._94482_cv;
- if(_loc2_ !== param1)
- {
- this._94482_cv = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_cv",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get _browse() : Button
- {
- return this._1327866793_browse;
- }
-
- public function set _preview(param1:SketchableLoadingProgressImage) : void
- {
- var _loc2_:Object = this._2040040073_preview;
- if(_loc2_ !== param1)
- {
- this._2040040073_preview = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_preview",_loc2_,param1));
- }
- }
-
- protected function onCreationComplete() : void
- {
- if(visible)
- {
- _browse.setFocus();
- }
- }
-
- protected function onSelect(param1:Event) : void
- {
- _mainDialog.enableLoad(true);
- _fileName.text = _file.url;
- _preview.source = _file.url;
- _mainDialog.selectedURL = _file.url;
- }
- }
- }
-
-